//
//  KLWeatherCell.m
//  KL
//
//  Created by mac on 15/12/17.
//  Copyright © 2015年 zhouxubin. All rights reserved.
//

#import "KLWeatherCell.h"
#import "KLWeatherFuture.h"

@interface KLWeatherCell ()
@property (weak, nonatomic) IBOutlet UILabel *weekLabel;
@property (weak, nonatomic) IBOutlet UILabel *infoLabel;
@property (weak, nonatomic) IBOutlet UILabel *tempture;


@end

@implementation KLWeatherCell

#pragma mark - 重写setter方法,给属性赋值
- (void)setFuture:(KLWeatherFuture *)future {
    _future = future;
    
    // 星期
    self.weekLabel.text = [NSString stringWithFormat:@"星期%@", future.week];
    
    // 天气
    self.infoLabel.text = [NSString stringWithFormat:@"%@ %@ %@", future.info[@"day"][1], future.info[@"day"][3], future.info[@"day"][4]];
    
    // 温度
    self.tempture.text = [NSString stringWithFormat:@"平均温度 %@°C", future.info[@"day"][2]];
}

#pragma mark - 快速创建对象
+ (instancetype)weatherCell {
    return [[NSBundle mainBundle] loadNibNamed:@"KLWeatherCell" owner:nil options:nil][0];
}

+ (instancetype)weatherCellWith:(UITableView *)tableView {
    KLWeatherCell *cell = [tableView dequeueReusableCellWithIdentifier:@"weather_cell"];
    if (!cell) {
        cell = [self weatherCell];
    }
    return cell;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
